package top.ed333.mcplugins.configurableevents.requirement;

import org.jetbrains.annotations.NotNull;

public class ReqGroupManager {
    public static ReqGroup getByNameAndExt(@NotNull String groupName, @NotNull String reqName, @NotNull Object ext) {
        ReqGroup result = null;
        switch (reqName) {
            case "Expression":
                result = new ExpressionReqGroup(groupName, ext.toString());
                break;
            case "PlayerHasItem":
                result = new PlayerHasItemReqGroup(groupName, ext.toString());
                break;
            case "PlayerHasPermission":
                result = new PlayerHasPermissionReqGroup(groupName, ext.toString());
                break;
            case "PlayerHasMoney":
                result = new PlayerHasMoneyReqGroup(groupName, (Double.parseDouble(ext.toString())));
                break;
            case "PlayerMoneyLessThan":
                result = new PlayerHasMoneyLessThanReqGroup(groupName, (Double.parseDouble(ext.toString())));
                break;
            case "PlayerHasPoint":
                result = new PlayerHasPointReqGroup(groupName, Integer.parseInt(ext.toString()));
                break;
            case "PlayerPointLessThan":
                result = new PlayerPointLessThanReqGroup(groupName, Integer.parseInt(ext.toString()));
                break;
            case "PlayerHasItemWithName":
                result = new PlayerHasItemWithNameReqGroup(groupName, ext.toString());
                break;
            case "PlayerHasItemWithLore":
                result = new PlayerHasItemWithLoreReqGroup(groupName, ext.toString());
                break;
            case "PlayerInGroup":
                result = new PlayerInGroupReqGroup(groupName, ext.toString());
                break;
        }
        return result;
    }
}
